package it.i118.jindice;


import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: sciovante
 * Date: 03/04/13
 * Time: 14.40
 */
public abstract class DataObject
        implements Serializable {

//    protected final long _id = System.currentTimeMillis();
    protected final long _id = -1;

    public long get_id() {
        return _id;
    }

    @Override
    public String toString() {
        return "DataObject." + getClass().getName() + "{" +
                "_id=" + get_id() +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        DataObject that = (DataObject) o;

        if (_id != that._id) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        return (int) (_id ^ (_id >>> 32));
    }
}
